JavaScript

A5.editgetSelection Method

Syntax

A5.edit.getSelection(element)

Arguments

elementelement

The INPUT or TEXTAREA element to retrieve the current selection of.

Returns

selectionobject

The current selection information.

startnumber

The start position.

endnumber

The end position.

lengthnumber

The length of the selection.

Description

Get the current selection in an edit control (INPUT or TEXTAREA).

Example

// assume that "ele" is a DOM element pointer to an INPUT control, and that the user has selected the last five characters of a twenty character value.
var sel = A5.edit.getSelection(ele);
// sel = {start: 14, end: 19, length: 5}